package com.aya.mybaits.spring.mapper;

import com.aya.mybaits.spring.domain.Blog;
import com.csn.stc.leesin.encrypt.EncryptStringTypeHandler;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author lius
 */
public interface BlogMapper {

    int insertAll(Blog blog);

    /**
     * sd
     *
     * @param id id
     * @return Blog
     */
    @Results({
            @Result(property = "title", column = "title", typeHandler = EncryptStringTypeHandler.class),
//            @Result(property = "id", column = "id", id = true),
//            @Result(property = "content", column = "content")
    })
//    @Select(" select id,title,content\n" +
//            "        from t_blog\n" +
//            "        where        id = #{id}\n")
    Blog selectBlog(@Param("id") Integer id);

    List<Blog> selectAllByTitleAndContent(@Param("title") String title, @Param("content") String content);

    List<Blog> selectBlogInId(List<String> ids);

    int updateTitleAndContentById(@Param("title") String title, @Param("content") String content, @Param("id") String id);


//    Cursor<Blog> selectAll();

    List<Blog> selectAllById(@Param("size") int size, @Param("id") String id);


}
